package test3

object Fobolaqie {
  def main(args: Array[String]): Unit = {
    val k=fact(6);
    println(k)
  }
  //语句块的最后一项是返回值
  def fact(i: Int): Int = {
    def f(j: Int, accu: Int): Int = {
      if (j <= 1)
        accu
      else
        f(j - 1, j * accu)
    }

    f(i, 1) //return
  }
}
